package com.alcohol.auth.server.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.security.oauth2.core.oidc.OidcScopes;

import java.util.ArrayList;
import java.util.List;

/**
 * @author LiXinYu
 * @date 2025/11/18
 */
@Getter
@AllArgsConstructor
public enum ScopeDesc {

    DEFAULT("default", "关联XX账号"),
    PROFILE1("1", "获取你的头像和昵称"),
    PROFILE2("2", "获取你的头像和昵称"),
    PROFILE(OidcScopes.PROFILE, "This application will be able to read your profile information.");

    private final String key;
    private final String description;

    public static List<String> getDesc(String keys) {
        List<String> result = new ArrayList<>();
        result.add(DEFAULT.getDescription());
        for (ScopeDesc scopeDesc : ScopeDesc.values()) {
            for (String key : keys.split(" ")) {
                if (scopeDesc.getKey().equals(key)) {
                    result.add(scopeDesc.getDescription());
                }
            }
        }

        return result;
    }
}
